package com.k.designpattern.creational.builder.buildercontext;

import java.util.function.Consumer;

public class PersonContext {
    private final PersonBuilder personBuilder;

    private PersonContext() {
        personBuilder = PersonBuilder.create();
    }

    public PersonContext setPerson(Consumer<PersonBuilder> c) {
        c.accept(this.personBuilder);
        return this;
    }

    public Person getPerson() {
        return this.personBuilder.build();
    }

    public static PersonContext create() {
        return new PersonContext();
    }
}
